<?php


namespace app\admin\controller;


use app\AdminRest;
use app\Request;
use think\facade\Filesystem;

class Common extends AdminRest
{

    public function uploadImg(Request $request)
    {
        $file = $request->file('file');
        $info = Filesystem::putFile('img', $file, 'md5');
        if (!empty($info)) {
            return $this->success(['url' => '/uploads/' . $info]);
        } else {
            return $this->error('上传失败');
        }
    }
}
